package com.spzx.user.controller;

import com.spzx.common.core.domain.R;
import com.spzx.common.core.web.controller.BaseController;
import com.spzx.common.core.web.domain.AjaxResult;
import com.spzx.common.security.annotation.RequiresLogin;
import com.spzx.user.domain.Region;
import com.spzx.user.domain.UserAddress;
import com.spzx.user.service.RegionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "地址列表接口管理")
@RestController
@RequestMapping("/region")
public class RegionController extends BaseController {
    @Autowired
    RegionService regionService;

    /**
     * 查询地址列表
     */
    @Operation(summary = "查询地址列表")
    @RequiresLogin
    @GetMapping("/treeSelect/{parentCode}")
    public R<List<Region>> getAddressList(@PathVariable("parentCode") String parentCode){
        List<Region> regions = regionService.getAddressList(parentCode);
        return R.ok(regions);
    }


}
